# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=vte3
pkgver=0.74.2
pkgrel=0
pkgdesc="Virtual Terminal Emulator library"
url="https://gitlab.gnome.org/GNOME/vte"
arch="all"
license="LGPL-2.0-or-later"
subpackages="$pkgname-dbg $pkgname-dev $pkgname-gtk4 $pkgname-lang"
makedepends="
	bash
	gnutls-dev
	gobject-introspection-dev
	gperf
	gtk+3.0-dev
	gtk4.0-dev
	gtk-doc
	icu-dev
	libxml2-utils
	linux-headers
	meson
	ncurses-dev
	pango-dev
	pcre2-dev
	vala
	"
source="https://gitlab.gnome.org/GNOME/vte/-/archive/$pkgver/vte-$pkgver.tar.gz
	fix-W_EXITCODE.patch
	"

builddir="$srcdir/vte-$pkgver"

build() {
	abuild-meson \
		-Dgtk4=true \
		-Ddocs=false \
		-D_systemd=false \
		. output
	meson compile -C output
}

check() {
	meson test --no-rebuild --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

gtk4() {
	pkgdesc="$pkgdesc (gtk4 component)"

	amove usr/bin/vte-*-gtk4
	amove usr/lib/libvte-*-gtk4.so.*
}

sha512sums="
3ccc35c08f0af1a9ba0699969d34ccc39ac28d1929c82fefe36133812ee6df9e3a3a0fd0e636aed6cf81f5b2b5b5cd345a8cb01c8a3a213edf6bc32eda03e208  vte-0.74.2.tar.gz
b6c1856bf075c2e3e91a0d4aff700c59e738bd6abe4122a11d680f104a2dab9d99f7d836a3ef3020b25ceff0a37231a6561eb917f0e4b9f90837eb634d8f7f20  fix-W_EXITCODE.patch
"
